home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
003
/
_gs
/
!GS
/
!Help
next >
Wrap
Text File
|
1991-12-06
|
13KB
|
278 lines
GhostScript for the Archimedes
==============================
Version: GS 2.2/Arc-2
!GS is a port of the public domain GhostScript interpreter to the
Archimedes. GhostScript is a page definition language closely resembling
PostScript (TM). See other documents included in the release for its history
and features. The port was carried out by David Elworthy.
Requirements
------------
!GS was developed on on A440. I haven't tried it on any other platforms. If
you have problems, let me know. I don't promise to do anything about them,
but I will try to take note for the next release.
Shared C library version 3.75 is needed for !GS. This is included in Acorn's
C release 4, and has also been released on the net; you should be able to
get it from the Newcastle info server. Try reading comp.sys.acorn if you
don't know of this.
Background
----------
The GhostScript language is a variant of PostScript (TM), a programming
language used principally for defining graphic images. !GS in an interpreter
for this language, which makes the graphic output available in the form of a
sprite. You can use !GS as a way of interpreting files of GhostScript
commands, or you can interactively type in commands. Most users won't need
to know anything about the language, but if you're interested, have a look
in the file doc.language.
The output of GhostScript is a page image in some form appropriate to the
platform it is running on. Some implementations allow output to more than
one device type. Devices which have been implemented include various PC
display formats, X windows and miscellaneous printers.
GhostScript is normally a command line program, using the standard I/O
streams (stdin, stdout, stderr in Unix terms) for communication with the
user, and some appropriate display for the output device. For example, Under
Unix with X windows, it runs as a Unix command, opening an X window for the
display device.
Using !GS
---------
!GS starts by placing an icon on the icon bar. You can execute a GhostScript
file by dropping it on the icon. The resulting "page" will be shown in a
window once the file has been executed; more on this below.
The icon bar menu has the following entries:
Info => information about !GS
Options => device options box
Fast
Show page
Quit
The device options box allows you to change the size of the output page, and
the output resolution. You can also set "save only" mode, in which case the
page is not displayed, and instead you get a save box for the output sprite.
The options are only changed if you click "Set". When "Fast" is set, then
!GS does not co-operate over multitasking, and blocks out other applications
while it executes a command or file. When unset (the default), other
applications can run concurrently, at the cost of slowing !GS down. "Show
page" issues a GhostScript "showpage" command, which displays the current
output page, or just the save box if "save only" is set. This is useful if
you wanted to save the output, but lost the save box. "Quit" closes !GS
down.
The output page is displayed in its own window. The menu for this window
consists of "Save", "Zoom", which leads you to a standard zoom dialogue box,
and "Zoom x 1", which resets the zoom factor to 1:1. The main menu is
disabled while the page window is up, and GhostScript commands are not
executed. When you've finished with the page window, click on the close icon
to remove it.
If you want to enter commands, or to see output messages from the !GS
interpreter, click select on the icon. Two windows are opened. The larger
one is for !GS output, and the smaller one (the read window) for input. Both
have menus, which are identical to the icon menu, and you can drop files in
the read window to execute them. If the page window is displayed, then
commands which you type in are not executed until it is removed.
A system variable, GS$Options, may be used to set the default options for
!GS. It consists of five numbers, four floats and an integer. The first two
are the width and height for the output image, in inches. The third and
fourth are the horizontal and vertical resolutions in pixels per inch. If
the variable is not set, or if a parameter is given as less than or equal to
zero, a default is used. The defaults are A4 size image, at 180 pixels per
inch. The final number sets "save only" mode, if non-zero.
To see it working ...
---------------------
Double click on !GS. The take the file "golfer" from the "ps" directory in
!GS, and drop it on the icon. This takes a while to execute, but eventually
you will get a page window. See the information in "doc" for some other
GhostScript files to try.
Modifying !GS
-------------
There are two reasons why you might want to modify !GS: to change the
implementation I have provided, and to add other device drivers. The
standard GhostScript release comes with code to produce output for a large
variety of printers and display devices; see "doc.drivers" for details.
To do the build itself, use the file Arc-Make with Acorn's AMU. I have been
using C release 4, and I have no idea if Arc-Make will work with earlier
versions of C. The target you need to build is !RunImage. You will need to
change the symbols RLIB and WIMPPLUS in Arc-Make. RLIB points to the
RISC_OSLib directory. WIMPPLUS points to a directory containing my own
WimpPlus library, which is supplied with the !GS release. You'll get lots of
warnings on compiling, but they can be safely ignored. Set the current
directory to !GS's directory before using Arc-Make.
Most of the Archimedes specific code is in c.gp_arc, c.gdevarc and
c.gdevarc1. The latter two files contain the code for generating sprite
output. gp_arc is intended to be independent of which output device you are
using, and does all the work of handling the main menu, and the read and
print windows; this includes such things as dropping files on the icon or
window. If you decide you want output to some other device, then keep
c.gp_arc and replace c.gdevarc and c.gdevarc1 with whatever other device
driver you want. The header h.gp_arc gives some hints on how to use it with
other devices. The main things you are likely to need to know are that you
can register a function for setting device specific options from the menu
(replacing the device options dbox described above), and a flag which tells
you if you are in fast mode or not. Ideally, the device driver should check
this flag from time to time, and call wimpc_checkpoint if it is set.
File naming
-----------
I have modified the file reading routines in GhostScript so that they
translate some file names into form which is more natural for the
Archimedes. Specifically, any file names of the form foo.name.ps or
foo.name.gsf are translated into foo.ps.name or foo.gsf.name. The former is
used for GhostScript files. The files in gsf are font files. Unfortunately,
it would be hard to make use of the Archimedes font manager, so you're stuck
with what they supply. If you are short of space, you can get rid of these,
with the exception of "uglyr", which is used if no other font can be found.
PrinterPS output
----------------
GhostScript usually falls over on output from !PrinterPS. This is because
output from PrinterPS (from some programs at least) lists all the fonts
known to the system. GhostScript tries to load them all, even if they are
not used, and runs out of memory. I'm not sure if this is a problem with
Acorn applications, with PrinterPS or with GhostScript - I just don't
understand the PostScript well enough to say. To get round this problem, try
deleting the lines in PrinterPS output files which look like:
/Corpus.Medium /Courier Latin1Enc FF
except (of course) for fonts actually used in the document!
GhostScript does support colour, but don't forget that you have to set up
PrinterPS for colour printing first.
Comments
--------
If you run a PostScript file containing several pages (i.e. several
"showpage" commands), then the page window is displayed for each one in
turn. Close the window to start processing the next page.
During rendering, input into the command line window is buffered. The icon
bar and command window menus are disabled (and, further, will be closed even
if you use Adjust to choose from them).
GS puts out a message after each page, saying "Press return to continue".
Ignore this: the return is issued automatically when you close the page
window. I ought really to take this out, but I'm too lazy.
If you are processing a long file and you decide to abandon it, the only way
is to get the task manager window up and force GS to quit from that. This
can also be used as a last resort if "Quit" on the menus doesn't seem to
work (which means that the PostScript command "quit" has somehow been
overridden). Of course, if you've set fast mode, you can't get the task
manager window up, until the page window appears at least, which is a bit of
a shame.
Inventory
---------
The following files and directories make up the release:
!Help - this file
!Run, !RunImage, !Sprites, Templates - standard application files
*Arc-Make - Archimedes makefile
*c - main part of C source
*h - main part of C headers
*WimpPlus - my extra Wimp Library
*GLibVia, ILibVia, MakeFile - files for building the release
COPYING, License - GNU License agreement
README, doc - miscellaneous documentation
FONTMAP - font mappings
gsf - font files
gs_via - Linker "via" file
*Specific - various files used in other implementations only (including
other device drivers)
ps - various PostScript files. Some of these can be run to produce pretty
pictures. Ones to try are golfer, chess, escher. Escher is quite slow, and
doesn't seem to leave the interpreter in a very clean state afterwards, so
don't be surprised if things go wrong after running this file. Note that
lines.ps (at least) contains more than one page.
To produce a minimal executable system, discard the files and
directories marked with *.
Nasties
-------
Here are some things wrong with the current implementation:
The output window is not perfect in the current version, and will flicker
horribly if there is a lot of rapid output to it. You may see this on
GhostScript errors which result in a stack trace.
The whole thing is rather slow. Partly this is in the main part of
GhostScript, but the device code could probably be speeded up too.
If you run a long file, there's no way of breaking into it.
Wish list for the next release
------------------------------
Fix the "nasties".
Allow the page window to be displayed as it gets constructed (as, for
example, the X windows version does). This would probably go in as an
option, since it would make things *even slower*.
Add something to give a reassurance that GS is doing something during long
processing.
A note on copying
-----------------
GhostScript is distributed under the terms of the General Public License
(GPL) devised by Richard Stallman. This can be found in the file COPYING.
Under the terms of this license I am required to distribute or otherwise
make available the source code. This includes both the code as distributed
by the authors of GhostScript, and any additional code written by me. You
will find this in the c, h and directories. WimpPlus contains my additional
code for doing things like printf into a window. No warranty or support is
offered with this code. You will need C release 4 if you intend to rebuild
the program.
(Rant starts)
Personally, I find the clause of the Stallman GPL requiring the source code
to be distributed somewhat objectionable. It replaces one form of control
(that of the corporate state) by another (namely that of Stallman and the
GNU conspiracy), albeit one which is more aimed towards the greater good.
A significant part of the work of porting GhostScript was in writing
WimpPlus. I could have chosen not to do this, and instead to leave it as a
command line program. Or, I could have chosen to port the program and not
distribute it. But, having decided that I would port it, add WimpPlus, and
distribute it, I am not given an opportunity to decide at what level of my
work should be made public.
On the other hand, I do freely give permission for WimpPlus to be used in
programs other than GhostScript, provided it is understood that no support
or warranty is offered. See the header files wimpc.h and wimpio.h for how to
use it.
(Rant ends)
I am:
David.Elworthy@cl.cam.ac.uk
also contactable as
David Elworthy,
18 Kimberley Road,
Cambridge CB4 1HH,
UK
Comments and suggestions for future versions are welcome.